#setwd('/afs/inf.ed.ac.uk/user/s17/s1725186/Documents/PhD-Models/FirstPUModel/RMarkdowns')

library(tidyverse) ; library(reshape2) ; library(glue) ; library(plotly) ; library(dendextend)
library(RColorBrewer) ; library(viridis) ; require(gridExtra) ; library(GGally)
library(knitr)
# Gandal dataset
load('./../Data/preprocessed_data.RData')
datExpr = datExpr %>% data.frame
DE_info = DE_info %>% data.frame


# GO Neuronal annotations: regex 'neuron' in GO functional annotations and label the genes that make a match as neuronal
GO_annotations = read.csv('./../Data/genes_GO_annotations.csv')
GO_neuronal = GO_annotations %>% filter(grepl('neuron', go_term)) %>% 
              mutate('ID'=as.character(ensembl_gene_id)) %>% 
              dplyr::select(-ensembl_gene_id) %>% distinct(ID) %>%
              mutate('Neuronal'=1)


# SFARI Genes
SFARI_genes = read_csv('./../../../SFARI/Data/SFARI_genes_01-03-2020_w_ensembl_IDs.csv')
SFARI_genes = SFARI_genes[!duplicated(SFARI_genes$ID) & !is.na(SFARI_genes$ID),]


# Clusterings
clusterings = read_csv('./../Data/clusters.csv')


# Update DE_info with SFARI and Neuronal information
genes_info = DE_info %>% mutate('ID'=rownames(.)) %>% left_join(SFARI_genes, by='ID') %>% 
  mutate(`gene-score`=ifelse(is.na(`gene-score`), 'Others', `gene-score`)) %>%
  left_join(GO_neuronal, by='ID') %>% left_join(clusterings, by='ID') %>%
  mutate(Neuronal=ifelse(is.na(Neuronal), 0, Neuronal)) %>%
  mutate(gene.score=ifelse(`gene-score`=='Others' & Neuronal==1, 'Neuronal', `gene-score`), 
         significant=padj<0.05 & !is.na(padj))


clustering_selected = 'DynamicHybrid'
genes_info$Module = genes_info[,clustering_selected]

dataset = read.csv(paste0('./../Data/dataset_', clustering_selected, '.csv'))
dataset$Module = dataset[,clustering_selected]

top_modules = dataset %>% arrange(desc(MTcor)) %>% filter(abs(MTcor)>0.9) %>% dplyr::pull(Module) %>% 
              unique %>% as.character

# Correct SFARI Scores
dataset$gene.score = genes_info$gene.score


# Load Enrichment Analyses

# GSEA
load('./../Data/GSEA_bonferroni.RData')
GSEA_GO = enrichment_GO
GSEA_DGN = enrichment_DGN
GSEA_DO = enrichment_DO
GSEA_KEGG = enrichment_KEGG
GSEA_Reactome = enrichment_Reactome
GSEA_SFARI = enrichment_SFARI

# ORA
load('./../Data/ORA_bonferroni.RData')
ORA_GO = enrichment_GO
ORA_DGN = enrichment_DGN
ORA_DO = enrichment_DO
ORA_KEGG = enrichment_KEGG
ORA_Reactome = enrichment_Reactome
ORA_SFARI = enrichment_SFARI



SFARI_colour_hue = function(r) {
  pal = c('#FF7631','#FFB100','#E8E328','#8CC83F','#62CCA6','#59B9C9','#b3b3b3','#808080','gray','#d9d9d9')[r]
}

rm(DE_info, GO_annotations, clusterings, getinfo, mart, dds, GO_neuronal, enrichment_GO, enrichment_DO,
   enrichment_DGN, erichment_DO, enrichment_KEGG, enrichment_Reactome)
# FUNCTIONS

compare_methods = function(GSEA_list, ORA_list){
  
  for(top_module in top_modules){
  
    cat(paste0('  \n  \n  \n  \nEnrichments for Module ', top_module, ' (MTcor=', 
               round(dataset$MTcor[dataset$Module==top_module][1],2), '):  \n  \n'))
    
    GSEA = GSEA_list[[top_module]]
    ORA = ORA_list[[top_module]]
    
    cat(paste0('GSEA has ', nrow(GSEA), ' enriched terms  \n'))
    cat(paste0('ORA has  ', nrow(ORA), ' enriched terms  \n'))
    cat(paste0(sum(ORA$ID %in% GSEA$ID), ' terms are enriched in both methods  \n'))
    
    plot_data = GSEA %>% mutate(pval_GSEA = p.adjust) %>% dplyr::select(ID, Description, NES, pval_GSEA) %>%
                inner_join(ORA %>% mutate(pval_ORA = p.adjust) %>% 
                           dplyr::select(ID, pval_ORA, GeneRatio, qvalue), by = 'ID') 
    
    if(nrow(plot_data)>0) print(plot_data %>% mutate(pval_mean = pval_ORA + pval_GSEA) %>% 
                                arrange(pval_mean) %>% dplyr::select(-pval_mean) %>% kable)
  } 
}


plot_results = function(GSEA_list, ORA_list){
  
  l = htmltools::tagList()

  for(i in 1:length(top_modules)){
    
    GSEA = GSEA_list[[top_modules[i]]]
    ORA = ORA_list[[top_modules[i]]]
    
    plot_data = GSEA %>% mutate(pval_GSEA = p.adjust) %>% dplyr::select(ID, Description, NES, pval_GSEA) %>%
                inner_join(ORA %>% mutate(pval_ORA = p.adjust) %>% dplyr::select(ID, pval_ORA), by = 'ID')
    
    if(nrow(plot_data)>5){
      min_val = min(min(plot_data$pval_GSEA), min(plot_data$pval_ORA))
      max_val = max(max(max(plot_data$pval_GSEA), max(plot_data$pval_ORA)),0.05)
      ggp = ggplotly(plot_data %>% ggplot(aes(pval_GSEA, pval_ORA, color = NES)) + 
                     geom_point(aes(id = Description)) + 
                     geom_vline(xintercept = 0.05, color = 'gray', linetype = 'dotted') + 
                     geom_hline(yintercept = 0.05, color = 'gray', linetype = 'dotted') + 
                     ggtitle(paste0('Enriched terms in common for Module ', top_modules[i])) +
                     scale_x_continuous(limits = c(min_val, max_val)) + 
                     scale_y_continuous(limits = c(min_val, max_val)) + 
                     xlab('Corrected p-value for GSEA') + ylab('Corrected p-value for ORA') +
                     scale_colour_viridis(direction = -1) + theme_minimal() + coord_fixed())
      l[[i]] = ggp
    }
  }
  
  return(l)
}

KEGG

compare_methods(GSEA_KEGG, ORA_KEGG)

Enrichments for Module #73B000 (MTcor=0.94):

GSEA has 42 enriched terms
ORA has 4 enriched terms
4 terms are enriched in both methods

ID Description NES pval_GSEA pval_ORA GeneRatio qvalue
hsa05034 Alcoholism 2.459042 0.0058904 0.0000000 54/649 0.0000000
hsa05322 Systemic lupus erythematosus 3.153606 0.0059327 0.0000000 45/649 0.0000000
hsa05202 Transcriptional misregulation in cancer 2.203888 0.0059057 0.0009106 36/649 0.0002912
hsa05203 Viral carcinogenesis 1.947256 0.0058775 0.0556118 35/649 0.0133392

Enrichments for Module #EE8045 (MTcor=0.93):

GSEA has 46 enriched terms
ORA has 4 enriched terms
4 terms are enriched in both methods

ID Description NES pval_GSEA pval_ORA GeneRatio qvalue
hsa05168 Herpes simplex virus 1 infection 2.552720 0.0043657 0.0000008 58/380 4.00e-07
hsa05034 Alcoholism 2.468803 0.0049104 0.0000671 28/380 2.21e-05
hsa05322 Systemic lupus erythematosus 3.116966 0.0051117 0.0000000 27/380 0.00e+00
hsa05203 Viral carcinogenesis 2.006682 0.0048435 0.0030437 27/380 7.53e-04

Enrichments for Module #00B9E3 (MTcor=-0.93):

GSEA has 47 enriched terms
ORA has 4 enriched terms
3 terms are enriched in both methods

ID Description NES pval_GSEA pval_ORA GeneRatio qvalue
hsa05033 Nicotine addiction 2.280163 0.0054286 0.0108575 13/699 0.0041822
hsa04020 Calcium signaling pathway 1.969428 0.0044889 0.0143596 38/699 0.0041822
hsa04728 Dopaminergic synapse 2.211123 0.0047074 0.0828857 27/699 0.0181054

Enrichments for Module #84AD00 (MTcor=-0.93):

GSEA has 37 enriched terms
ORA has 0 enriched terms
0 terms are enriched in both methods

Reactome

compare_methods(GSEA_Reactome, ORA_Reactome)

Enrichments for Module #73B000 (MTcor=0.94):

GSEA has 170 enriched terms
ORA has 78 enriched terms
76 terms are enriched in both methods

ID Description NES pval_GSEA pval_ORA GeneRatio qvalue
R-HSA-3247509 Chromatin modifying enzymes 2.278873 0.0243207 0.0000002 57/814 0.0000000
R-HSA-4839726 Chromatin organization 2.278873 0.0243207 0.0000002 57/814 0.0000000
R-HSA-9006931 Signaling by Nuclear Receptors 2.381399 0.0243898 0.0000002 55/814 0.0000000
R-HSA-8878171 Transcriptional regulation by RUNX1 2.201971 0.0244490 0.0000006 50/814 0.0000000
R-HSA-157118 Signaling by NOTCH 2.214671 0.0244334 0.0000404 47/814 0.0000006
R-HSA-8939211 ESR-mediated signaling 2.590280 0.0244928 0.0000000 53/814 0.0000000
R-HSA-201681 TCF dependent signaling in response to WNT 2.034284 0.0244125 0.0000857 45/814 0.0000013
R-HSA-2559583 Cellular Senescence 2.480288 0.0246088 0.0000000 58/814 0.0000000
R-HSA-9018519 Estrogen-dependent gene expression 2.977948 0.0247648 0.0000000 45/814 0.0000000
R-HSA-212165 Epigenetic regulation of gene expression 2.462506 0.0247974 0.0000000 42/814 0.0000000
R-HSA-211000 Gene Silencing by RNA 2.604248 0.0247987 0.0000000 43/814 0.0000000
R-HSA-3214847 HATs acetylate histones 2.598060 0.0248199 0.0000000 46/814 0.0000000
R-HSA-68875 Mitotic Prophase 2.803678 0.0248199 0.0000000 45/814 0.0000000
R-HSA-2559580 Oxidative Stress Induced Senescence 2.699026 0.0249135 0.0000000 44/814 0.0000000
R-HSA-1474165 Reproduction 3.018783 0.0249159 0.0000000 48/814 0.0000000
R-HSA-8939236 RUNX1 regulates transcription of genes involved in differentiation of HSCs 2.515455 0.0249302 0.0000000 40/814 0.0000000
R-HSA-977225 Amyloid fiber formation 3.054978 0.0249353 0.0000000 40/814 0.0000000
R-HSA-1500620 Meiosis 3.047447 0.0249511 0.0000000 45/814 0.0000000
R-HSA-73864 RNA Polymerase I Transcription 2.759782 0.0249660 0.0000000 40/814 0.0000000
R-HSA-5617472 Activation of anterior HOX genes in hindbrain development during early embryogenesis 3.005654 0.0249660 0.0000000 40/814 0.0000000
R-HSA-5619507 Activation of HOX genes during differentiation 3.005654 0.0249660 0.0000000 40/814 0.0000000
R-HSA-5578749 Transcriptional regulation by small RNAs 2.925635 0.0250196 0.0000000 41/814 0.0000000
R-HSA-5250913 Positive epigenetic regulation of rRNA expression 2.789580 0.0250196 0.0000000 40/814 0.0000000
R-HSA-427413 NoRC negatively regulates rRNA expression 2.815700 0.0250196 0.0000000 39/814 0.0000000
R-HSA-3214815 HDACs deacetylate histones 3.027939 0.0250215 0.0000000 42/814 0.0000000
R-HSA-73854 RNA Polymerase I Promoter Clearance 2.732154 0.0250247 0.0000000 40/814 0.0000000
R-HSA-2559582 Senescence-Associated Secretory Phenotype (SASP) 3.033487 0.0250294 0.0000000 44/814 0.0000000
R-HSA-1912422 Pre-NOTCH Expression and Processing 3.120790 0.0250294 0.0000000 43/814 0.0000000
R-HSA-5250941 Negative epigenetic regulation of rRNA expression 2.768677 0.0250294 0.0000000 40/814 0.0000000
R-HSA-912446 Meiotic recombination 3.195567 0.0250397 0.0000000 40/814 0.0000000
R-HSA-73772 RNA Polymerase I Promoter Escape 2.995694 0.0250505 0.0000000 39/814 0.0000000
R-HSA-5250924 B-WICH complex positively regulates rRNA expression 2.968917 0.0250505 0.0000000 39/814 0.0000000
R-HSA-5625740 RHO GTPases activate PKNs 3.100816 0.0250673 0.0000000 41/814 0.0000000
R-HSA-1912408 Pre-NOTCH Transcription and Translation 3.192122 0.0250673 0.0000000 39/814 0.0000000
R-HSA-8936459 RUNX1 regulates genes involved in megakaryocyte differentiation and platelet function 3.120711 0.0250673 0.0000000 38/814 0.0000000
R-HSA-2299718 Condensation of Prophase Chromosomes 3.346491 0.0250763 0.0000000 38/814 0.0000000
R-HSA-5693571 Nonhomologous End-Joining (NHEJ) 2.460174 0.0250763 0.0000079 23/814 0.0000001
R-HSA-212300 PRC2 methylates histones and DNA 3.227406 0.0250861 0.0000000 39/814 0.0000000
R-HSA-606279 Deposition of new CENPA-containing nucleosomes at the centromere 2.897203 0.0250861 0.0000020 24/814 0.0000000
R-HSA-774815 Nucleosome assembly 2.897203 0.0250861 0.0000020 24/814 0.0000000
R-HSA-201722 Formation of the beta-catenin:TCF transactivating complex 3.071049 0.0250927 0.0000000 38/814 0.0000000
R-HSA-73884 Base Excision Repair 2.546982 0.0250805 0.0000145 26/814 0.0000002
R-HSA-3214841 PKMTs methylate histone lysines 2.710487 0.0251059 0.0000000 29/814 0.0000000
R-HSA-5334118 DNA methylation 3.354489 0.0251134 0.0000000 37/814 0.0000000
R-HSA-73728 RNA Polymerase I Promoter Opening 3.315263 0.0251134 0.0000000 37/814 0.0000000
R-HSA-5625886 Activated PKN1 stimulates transcription of AR (androgen receptor) regulated genes KLK2 and KLK3 3.404989 0.0251148 0.0000000 37/814 0.0000000
R-HSA-1221632 Meiotic synapsis 2.972464 0.0251148 0.0000000 27/814 0.0000000
R-HSA-427389 ERCC6 (CSB) and EHMT2 (G9a) positively regulate rRNA expression 3.166086 0.0251176 0.0000000 38/814 0.0000000
R-HSA-2559586 DNA Damage/Telomere Stress Induced Senescence 2.789390 0.0251223 0.0000000 28/814 0.0000000
R-HSA-73929 Base-Excision Repair, AP Site Formation 2.892719 0.0251228 0.0000000 24/814 0.0000000
R-HSA-427359 SIRT1 negatively regulates rRNA expression 3.250592 0.0251285 0.0000000 38/814 0.0000000
R-HSA-3214858 RMTs methylate histone arginines 2.859401 0.0251318 0.0000000 39/814 0.0000000
R-HSA-157579 Telomere Maintenance 2.672800 0.0251318 0.0000037 25/814 0.0000001
R-HSA-110328 Recognition and association of DNA glycosylase with site containing an affected pyrimidine 2.921933 0.0251435 0.0000000 24/814 0.0000000
R-HSA-110329 Cleavage of the damaged pyrimidine 2.921933 0.0251435 0.0000000 24/814 0.0000000
R-HSA-73928 Depyrimidination 2.921933 0.0251435 0.0000000 24/814 0.0000000
R-HSA-3214842 HDMs demethylate histones 2.973280 0.0251648 0.0000000 31/814 0.0000000
R-HSA-110330 Recognition and association of DNA glycosylase with site containing an affected purine 3.020401 0.0251918 0.0000000 24/814 0.0000000
R-HSA-110331 Cleavage of the damaged purine 3.020401 0.0251918 0.0000000 24/814 0.0000000
R-HSA-73927 Depurination 3.020401 0.0251918 0.0000000 24/814 0.0000000
R-HSA-5693565 Recruitment and ATM-mediated phosphorylation of repair and signaling proteins at DNA double strand breaks 2.396526 0.0251252 0.0000692 23/814 0.0000010
R-HSA-73886 Chromosome Maintenance 2.483760 0.0249846 0.0002307 27/814 0.0000033
R-HSA-5693606 DNA Double Strand Break Response 2.396061 0.0251318 0.0000919 23/814 0.0000013
R-HSA-171306 Packaging Of Telomere Ends 3.053194 0.0252883 0.0000000 23/814 0.0000000
R-HSA-195258 RHO GTPase Effectors 1.840488 0.0241978 0.0012650 54/814 0.0000171
R-HSA-1266695 Interleukin-7 signaling 2.306149 0.0253327 0.0004422 14/814 0.0000062
R-HSA-69473 G2/M DNA damage checkpoint 2.341737 0.0249683 0.0014260 24/814 0.0000191
R-HSA-5693607 Processing of DNA double-strand break ends 2.341501 0.0249725 0.0026772 24/814 0.0000353
R-HSA-5693567 HDR through Homologous Recombination (HRR) or Single Strand Annealing (SSA) 2.235138 0.0248641 0.0223680 27/814 0.0002827
R-HSA-2262752 Cellular responses to stress 1.632674 0.0477761 0.0000079 73/814 0.0000001
R-HSA-195721 Signaling by WNT 1.690092 0.0484043 0.0001708 57/814 0.0000025
R-HSA-6785807 Interleukin-4 and Interleukin-13 signaling 2.497601 0.0250439 0.0345609 21/814 0.0004310
R-HSA-3108232 SUMO E3 ligases SUMOylate target proteins 2.093088 0.0245655 0.0462864 33/814 0.0005697
R-HSA-194315 Signaling by Rho GTPases 1.594680 0.0715557 0.0064006 67/814 0.0000820
R-HSA-5693538 Homology Directed Repair 2.171556 0.0248447 0.0534816 27/814 0.0006497
R-HSA-2990846 SUMOylation 2.007948 0.0245606 0.0925865 33/814 0.0011103

Enrichments for Module #EE8045 (MTcor=0.93):

GSEA has 204 enriched terms
ORA has 76 enriched terms
73 terms are enriched in both methods

ID Description NES pval_GSEA pval_ORA GeneRatio qvalue
R-HSA-3247509 Chromatin modifying enzymes 2.382042 0.0195119 0.0000001 43/495 0.0000000
R-HSA-4839726 Chromatin organization 2.382042 0.0195119 0.0000001 43/495 0.0000000
R-HSA-9006931 Signaling by Nuclear Receptors 2.206897 0.0196781 0.0001857 35/495 0.0000025
R-HSA-8878171 Transcriptional regulation by RUNX1 2.261105 0.0198763 0.0000101 35/495 0.0000001
R-HSA-8939211 ESR-mediated signaling 2.449368 0.0200212 0.0000071 34/495 0.0000001
R-HSA-2559583 Cellular Senescence 2.295883 0.0202788 0.0000003 34/495 0.0000000
R-HSA-3108232 SUMO E3 ligases SUMOylate target proteins 2.071740 0.0203379 0.0000953 29/495 0.0000013
R-HSA-2990846 SUMOylation 1.979695 0.0202852 0.0002019 29/495 0.0000027
R-HSA-157118 Signaling by NOTCH 1.951114 0.0198181 0.0006943 32/495 0.0000091
R-HSA-5693532 DNA Double-Strand Break Repair 2.018206 0.0205764 0.0001818 27/495 0.0000025
R-HSA-212165 Epigenetic regulation of gene expression 2.555835 0.0208463 0.0000005 29/495 0.0000000
R-HSA-9018519 Estrogen-dependent gene expression 2.861305 0.0208499 0.0000000 32/495 0.0000000
R-HSA-3214847 HATs acetylate histones 2.695651 0.0209365 0.0000002 29/495 0.0000000
R-HSA-68875 Mitotic Prophase 2.687889 0.0209365 0.0000008 28/495 0.0000000
R-HSA-211000 Gene Silencing by RNA 2.636333 0.0209926 0.0000003 28/495 0.0000000
R-HSA-5693567 HDR through Homologous Recombination (HRR) or Single Strand Annealing (SSA) 2.229659 0.0210738 0.0000847 24/495 0.0000012
R-HSA-1474165 Reproduction 2.990888 0.0211577 0.0000017 26/495 0.0000000
R-HSA-8939236 RUNX1 regulates transcription of genes involved in differentiation of HSCs 2.458849 0.0211600 0.0000014 26/495 0.0000000
R-HSA-5693538 Homology Directed Repair 2.149519 0.0210048 0.0002120 24/495 0.0000028
R-HSA-2559580 Oxidative Stress Induced Senescence 2.542884 0.0212351 0.0000000 29/495 0.0000000
R-HSA-73864 RNA Polymerase I Transcription 2.772099 0.0214081 0.0000001 26/495 0.0000000
R-HSA-5617472 Activation of anterior HOX genes in hindbrain development during early embryogenesis 2.867060 0.0214081 0.0000001 26/495 0.0000000
R-HSA-5619507 Activation of HOX genes during differentiation 2.867060 0.0214081 0.0000001 26/495 0.0000000
R-HSA-73854 RNA Polymerase I Promoter Clearance 2.753275 0.0214122 0.0000000 26/495 0.0000000
R-HSA-1500620 Meiosis 3.041621 0.0214335 0.0000001 26/495 0.0000000
R-HSA-2559582 Senescence-Associated Secretory Phenotype (SASP) 2.919696 0.0214362 0.0000000 29/495 0.0000000
R-HSA-1912422 Pre-NOTCH Expression and Processing 2.995518 0.0214362 0.0000000 26/495 0.0000000
R-HSA-5250941 Negative epigenetic regulation of rRNA expression 2.813435 0.0214362 0.0000002 25/495 0.0000000
R-HSA-5250913 Positive epigenetic regulation of rRNA expression 2.745753 0.0214971 0.0000000 26/495 0.0000000
R-HSA-427413 NoRC negatively regulates rRNA expression 2.872722 0.0214971 0.0000001 25/495 0.0000000
R-HSA-5578749 Transcriptional regulation by small RNAs 2.865456 0.0214971 0.0000001 25/495 0.0000000
R-HSA-73886 Chromosome Maintenance 2.490931 0.0215019 0.0000001 25/495 0.0000000
R-HSA-5693607 Processing of DNA double-strand break ends 2.388162 0.0216587 0.0000002 24/495 0.0000000
R-HSA-977225 Amyloid fiber formation 2.976874 0.0216948 0.0000001 24/495 0.0000000
R-HSA-69473 G2/M DNA damage checkpoint 2.394096 0.0217515 0.0000005 23/495 0.0000000
R-HSA-3214815 HDACs deacetylate histones 3.183673 0.0217741 0.0000000 26/495 0.0000000
R-HSA-1912408 Pre-NOTCH Transcription and Translation 3.167742 0.0218376 0.0000000 26/495 0.0000000
R-HSA-8936459 RUNX1 regulates genes involved in megakaryocyte differentiation and platelet function 3.142486 0.0218376 0.0000000 26/495 0.0000000
R-HSA-5625740 RHO GTPases activate PKNs 3.092663 0.0218376 0.0000000 24/495 0.0000000
R-HSA-5250924 B-WICH complex positively regulates rRNA expression 2.945840 0.0218633 0.0000000 25/495 0.0000000
R-HSA-73772 RNA Polymerase I Promoter Escape 3.024781 0.0218633 0.0000000 24/495 0.0000000
R-HSA-201722 Formation of the beta-catenin:TCF transactivating complex 2.931072 0.0218740 0.0000000 26/495 0.0000000
R-HSA-73884 Base Excision Repair 2.481520 0.0218801 0.0000001 23/495 0.0000000
R-HSA-912446 Meiotic recombination 3.177327 0.0220402 0.0000000 24/495 0.0000000
R-HSA-2559586 DNA Damage/Telomere Stress Induced Senescence 2.845834 0.0220842 0.0000000 23/495 0.0000000
R-HSA-5693606 DNA Double Strand Break Response 2.658132 0.0220896 0.0000000 23/495 0.0000000
R-HSA-157579 Telomere Maintenance 2.678335 0.0220896 0.0000000 23/495 0.0000000
R-HSA-5693565 Recruitment and ATM-mediated phosphorylation of repair and signaling proteins at DNA double strand breaks 2.669142 0.0220969 0.0000000 23/495 0.0000000
R-HSA-427389 ERCC6 (CSB) and EHMT2 (G9a) positively regulate rRNA expression 3.166898 0.0221338 0.0000000 25/495 0.0000000
R-HSA-3214858 RMTs methylate histone arginines 2.745707 0.0220896 0.0000751 18/495 0.0000011
R-HSA-1221632 Meiotic synapsis 3.021587 0.0221711 0.0000000 25/495 0.0000000
R-HSA-3214841 PKMTs methylate histone lysines 2.560910 0.0221843 0.0000000 21/495 0.0000000
R-HSA-606279 Deposition of new CENPA-containing nucleosomes at the centromere 2.832629 0.0221954 0.0000000 25/495 0.0000000
R-HSA-774815 Nucleosome assembly 2.832629 0.0221954 0.0000000 25/495 0.0000000
R-HSA-212300 PRC2 methylates histones and DNA 3.195257 0.0221954 0.0000000 24/495 0.0000000
R-HSA-2299718 Condensation of Prophase Chromosomes 3.267881 0.0222082 0.0000000 24/495 0.0000000
R-HSA-5693571 Nonhomologous End-Joining (NHEJ) 2.633793 0.0222082 0.0000000 24/495 0.0000000
R-HSA-427359 SIRT1 negatively regulates rRNA expression 3.259000 0.0223359 0.0000000 23/495 0.0000000
R-HSA-5625886 Activated PKN1 stimulates transcription of AR (androgen receptor) regulated genes KLK2 and KLK3 3.428710 0.0224452 0.0000000 24/495 0.0000000
R-HSA-5334118 DNA methylation 3.406522 0.0225278 0.0000000 23/495 0.0000000
R-HSA-73728 RNA Polymerase I Promoter Opening 3.355613 0.0225278 0.0000000 23/495 0.0000000
R-HSA-73929 Base-Excision Repair, AP Site Formation 2.824304 0.0225502 0.0000000 23/495 0.0000000
R-HSA-110328 Recognition and association of DNA glycosylase with site containing an affected pyrimidine 2.857918 0.0225696 0.0000000 23/495 0.0000000
R-HSA-110329 Cleavage of the damaged pyrimidine 2.857918 0.0225696 0.0000000 23/495 0.0000000
R-HSA-73928 Depyrimidination 2.857918 0.0225696 0.0000000 23/495 0.0000000
R-HSA-3214842 HDMs demethylate histones 2.792860 0.0227196 0.0000056 16/495 0.0000001
R-HSA-110330 Recognition and association of DNA glycosylase with site containing an affected purine 2.955917 0.0227469 0.0000000 23/495 0.0000000
R-HSA-110331 Cleavage of the damaged purine 2.955917 0.0227469 0.0000000 23/495 0.0000000
R-HSA-73927 Depurination 2.955917 0.0227469 0.0000000 23/495 0.0000000
R-HSA-171306 Packaging Of Telomere Ends 3.029616 0.0228412 0.0000000 23/495 0.0000000
R-HSA-195258 RHO GTPase Effectors 1.829443 0.0191205 0.0124005 36/495 0.0001556
R-HSA-201681 TCF dependent signaling in response to WNT 1.685616 0.0398614 0.0025650 30/495 0.0000331
R-HSA-4551638 SUMOylation of chromatin organization proteins 2.046488 0.0442675 0.0000045 19/495 0.0000001

Enrichments for Module #00B9E3 (MTcor=-0.93):

GSEA has 90 enriched terms
ORA has 13 enriched terms
8 terms are enriched in both methods

ID Description NES pval_GSEA pval_ORA GeneRatio qvalue
R-HSA-112316 Neuronal System 2.643595 0.0169280 0.0000000 92/1003 0.0000000
R-HSA-112315 Transmission across Chemical Synapses 2.572379 0.0179982 0.0001390 56/1003 0.0000413
R-HSA-112314 Neurotransmitter receptors and postsynaptic signal transmission 2.501833 0.0187214 0.0000146 48/1003 0.0000065
R-HSA-1296071 Potassium Channels 2.209534 0.0204446 0.0020191 27/1003 0.0004499
R-HSA-442755 Activation of NMDA receptors and postsynaptic events 2.413330 0.0206268 0.0036733 25/1003 0.0006548
R-HSA-1296072 Voltage gated Potassium channels 2.533345 0.0222219 0.0164424 15/1003 0.0024423
R-HSA-438064 Post NMDA receptor activation events 2.314038 0.0210213 0.0395355 21/1003 0.0050336
R-HSA-438066 Unblocking of NMDA receptors, glutamate binding and activation 2.398864 0.0233726 0.0665704 10/1003 0.0059330

Enrichments for Module #84AD00 (MTcor=-0.93):

GSEA has 81 enriched terms
ORA has 0 enriched terms
0 terms are enriched in both methods

Plots of the results when there are more than 5 terms in common between methods:

plot_results(GSEA_Reactome, ORA_Reactome)


Gene Ontology

compare_methods(GSEA_GO, ORA_GO)

Enrichments for Module #73B000 (MTcor=0.94):

GSEA has 0 enriched terms
ORA has 60 enriched terms
0 terms are enriched in both methods

Enrichments for Module #EE8045 (MTcor=0.93):

GSEA has 0 enriched terms
ORA has 43 enriched terms
0 terms are enriched in both methods

Enrichments for Module #00B9E3 (MTcor=-0.93):

GSEA has 61 enriched terms
ORA has 95 enriched terms
31 terms are enriched in both methods

ID Description NES pval_GSEA pval_ORA GeneRatio qvalue
GO:0044297 cell body 2.079677 0.0911222 0.0001105 92/1556 0.0000051
GO:0034762 regulation of transmembrane transport 2.116789 0.0916164 0.0001355 91/1486 0.0000256
GO:0043025 neuronal cell body 2.184071 0.0929181 0.0000414 84/1556 0.0000024
GO:0098793 presynapse 2.655547 0.0931848 0.0000000 96/1556 0.0000000
GO:0008324 cation transmembrane transporter activity 2.158107 0.0932786 0.0000008 86/1474 0.0000001
GO:0015672 monovalent inorganic cation transport 2.246078 0.0934727 0.0000011 87/1486 0.0000005
GO:0034765 regulation of ion transmembrane transport 2.244908 0.0934692 0.0000152 84/1486 0.0000048
GO:0022890 inorganic cation transmembrane transporter activity 2.206956 0.0944116 0.0000004 82/1474 0.0000000
GO:0097060 synaptic membrane 2.405299 0.0946283 0.0000000 99/1556 0.0000000
GO:0098978 glutamatergic synapse 2.459707 0.0959919 0.0000186 72/1556 0.0000013
GO:0033267 axon part 2.619227 0.0960165 0.0000371 71/1556 0.0000023
GO:0022803 passive transmembrane transporter activity 2.060957 0.0971431 0.0000000 74/1474 0.0000000
GO:0015267 channel activity 2.052951 0.0972098 0.0000001 73/1474 0.0000000
GO:0046873 metal ion transmembrane transporter activity 2.109624 0.0980997 0.0000215 64/1474 0.0000015
GO:0022838 substrate-specific channel activity 2.118246 0.0983712 0.0000000 70/1474 0.0000000
GO:0098984 neuron to neuron synapse 2.317062 0.0973726 0.0010876 62/1556 0.0000331
GO:0099572 postsynaptic specialization 2.289442 0.0973726 0.0010876 62/1556 0.0000331
GO:0045211 postsynaptic membrane 2.326902 0.0986545 0.0000000 73/1556 0.0000000
GO:0005216 ion channel activity 2.151565 0.0987311 0.0000000 70/1474 0.0000000
GO:0042391 regulation of membrane potential 2.086443 0.0962160 0.0026710 67/1486 0.0002102
GO:0005874 microtubule 2.056455 0.0960165 0.0033416 65/1556 0.0000952
GO:0050808 synapse organization 2.146128 0.0945592 0.0049189 72/1486 0.0003574
GO:0032279 asymmetric synapse 2.287187 0.0982668 0.0023511 58/1556 0.0000692
GO:0050804 modulation of chemical synaptic transmission 2.364855 0.0947766 0.0066467 71/1486 0.0004484
GO:0099177 regulation of trans-synaptic signaling 2.363625 0.0947335 0.0073571 71/1486 0.0004633
GO:0014069 postsynaptic density 2.260041 0.0985094 0.0066693 56/1556 0.0001841
GO:0023061 signal release 2.161013 0.0945151 0.0238989 70/1486 0.0011339
GO:0030133 transport vesicle 2.225514 0.0968683 0.0250537 59/1556 0.0006707
GO:1904062 regulation of cation transmembrane transport 2.206381 0.0988430 0.0240089 56/1486 0.0011339
GO:0099513 polymeric cytoskeletal fiber 1.741064 0.0917699 0.0583565 78/1556 0.0013219
GO:0050890 cognition 1.969506 0.0998270 0.0905656 51/1486 0.0033379

Enrichments for Module #84AD00 (MTcor=-0.93):

GSEA has 0 enriched terms
ORA has 9 enriched terms
0 terms are enriched in both methods

Plots of the results when there are more than 5 terms in common between methods:

plot_results(GSEA_GO, ORA_GO)


Disease Ontology

compare_methods(GSEA_DO, ORA_DO)

Enrichments for Module #73B000 (MTcor=0.94):

GSEA has 137 enriched terms
ORA has 0 enriched terms
0 terms are enriched in both methods

Enrichments for Module #EE8045 (MTcor=0.93):

GSEA has 128 enriched terms
ORA has 3 enriched terms
2 terms are enriched in both methods

ID Description NES pval_GSEA pval_ORA GeneRatio qvalue
DOID:1579 respiratory system disease 2.273814 0.0106829 0.0467996 44/363 0.0161951
DOID:0050161 lower respiratory tract disease 2.276961 0.0108113 0.0510984 41/363 0.0161951

Enrichments for Module #00B9E3 (MTcor=-0.93):

GSEA has 111 enriched terms
ORA has 1 enriched terms
1 terms are enriched in both methods

ID Description NES pval_GSEA pval_ORA GeneRatio qvalue
DOID:1826 epilepsy syndrome 2.070965 0.0109172 0.0320472 39/687 0.0320472

Enrichments for Module #84AD00 (MTcor=-0.93):

GSEA has 103 enriched terms
ORA has 0 enriched terms
0 terms are enriched in both methods

Disease Gene Network

compare_methods(GSEA_DGN, ORA_DGN)

Enrichments for Module #73B000 (MTcor=0.94):

GSEA has 0 enriched terms
ORA has 6 enriched terms
0 terms are enriched in both methods

Enrichments for Module #EE8045 (MTcor=0.93):

GSEA has 49 enriched terms
ORA has 5 enriched terms
1 terms are enriched in both methods

ID Description NES pval_GSEA pval_ORA GeneRatio qvalue
umls:C3495559 Juvenile arthritis 2.37454 0.0496448 0.0196758 34/697 0.0038244

Enrichments for Module #00B9E3 (MTcor=-0.93):

GSEA has 6 enriched terms
ORA has 4 enriched terms
1 terms are enriched in both methods

ID Description NES pval_GSEA pval_ORA GeneRatio qvalue
umls:C0004936 Mental disorders 1.688912 0.0431365 0.0441081 71/1413 0.0147027

Enrichments for Module #84AD00 (MTcor=-0.93):

GSEA has 0 enriched terms
ORA has 0 enriched terms
0 terms are enriched in both methods